function DateTime(date: Date, format: string = 'YYYY-MM-DD hh:mm:ss'): string {
  const map = {
    'YYYY': date.getFullYear().toString(),
    'M': String(date.getMonth() + 1),
    'MM': String(date.getMonth() + 1).padStart(2, '0'),
    'D': String(date.getDate()),
    'DD': String(date.getDate()).padStart(2, '0'),
    'h': String(date.getHours()),
    'hh': String(date.getHours()).padStart(2, '0'),
    'm': String(date.getMinutes()),
    'mm': String(date.getMinutes()).padStart(2, '0'),
    's': String(date.getSeconds()),
    'ss': String(date.getSeconds()).padStart(2, '0'),
  };

  return format.replace(/YYYY|MM|M|DD|D|hh|h|mm|m|ss|s/g, (match) => {
    return map[match as keyof typeof map] || match;
  });
};

export {
  DateTime
}